<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>
    console.log(11111);

    document.onclick = function(){
        console.log(44444);
    }

    setTimeout(()=>{
        console.log(55555);
    },0)

    let xhr = new XMLHttpRequest(); // 0

    xhr.open("get", "../data/goods.json", true); // 1

    xhr.send();  // 1

    xhr.onreadystatechange = function () {
        // 2 3 4
        console.log("xhr.readyState改变了", xhr.readyState);
        if (xhr.readyState == 4 && xhr.status == 200) {
            var res = xhr.responseText;
            var data = JSON.parse(res);
            console.log(22222);
        }
    }
    console.log(33333);
</script>

</html>